﻿using Domain.Entity;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace EFCore.Configers
{
    public class CFSKConfigers : IEntityTypeConfiguration<CFSK>
    {
        public void Configure(EntityTypeBuilder<CFSK> builder)
        {
            builder.ToTable(nameof(CFSK));
            builder.Property(x => x.FirstKindId).IsRequired(false).HasMaxLength(2);
            builder.Property(x => x.FirstKindName).IsRequired(false).HasMaxLength(60);
            builder.Property(x => x.SecondKindId).IsRequired(false).HasMaxLength(2);
            builder.Property(x => x.SecondKindName).IsRequired(false).HasMaxLength(60);
            builder.Property(x => x.SecondSalaryId).IsRequired(false);
            builder.Property(x => x.SecondSaleId).IsRequired(false);

            builder.HasData(new CFSK()
            {
                FskId = 1,
                FirstKindId = "01",
                FirstKindName = "集团",
                SecondKindId = "01",
                SecondKindName = "软件公司",
                SecondSalaryId = "1",
                SecondSaleId = "1",
            }, new CFSK()
            {
                FskId = 2,
                FirstKindId = "01",
                FirstKindName = "集团",
                SecondKindId = "02",
                SecondKindName = "生物科技有限公司",
                SecondSalaryId = "1",
                SecondSaleId = "1",
            }
            );
        }
    }
}
